//
//  BYAddImageModel.m
//  ZhaoQiPei
//
//  Created by 找汽配 on 16/3/5.
//  Copyright © 2016年 祥运. All rights reserved.
//

#import "XYImageSelectModel.h"

@implementation XYImageSelectModel

+ (instancetype)model {
    XYImageSelectModel * model = [[self alloc] init];
    return model;
}

- (void)modelDidUpdate {
    if (self.delegate && [self.delegate respondsToSelector:@selector(imageSelectModelDidUpdate)]) {
        [self.delegate imageSelectModelDidUpdate];
    }
}

- (void)reloadImage {
    if (self.action && [self.action respondsToSelector:@selector(imageSelectModelReloadImage:)]) {
        [self.action imageSelectModelReloadImage:self];
    }
}

- (void)uploadImage {
    if (self.action && [self.action respondsToSelector:@selector(imageSelectModelUploadImage:)]) {
        [self.action imageSelectModelUploadImage:self];
    }
}

- (void)uploadWillStart {
    self.uploading = YES;
    if (self.delegate && [self.delegate respondsToSelector:@selector(imageSelectModelWillUploadImage)]) {
        [self.delegate imageSelectModelWillUploadImage];
    }
}

- (void)uploadDidComplete {
    self.uploading = NO;
    if (self.delegate && [self.delegate respondsToSelector:@selector(imageSelectModelDidUploadImage)]) {
        [self.delegate imageSelectModelDidUploadImage];
    }
}

- (void)setProgress:(CGFloat)progress {
    _progress = progress;
    if (self.delegate && [self.delegate respondsToSelector:@selector(imageSelectModelUploadingImageWithProgress:)]) {
        [self.delegate imageSelectModelUploadingImageWithProgress:progress];
    }
}

@end
